/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package mailserver;

import java.io.BufferedReader;
import java.io.DataOutputStream;
import java.io.InputStreamReader;
import java.net.ServerSocket;
import java.net.Socket;

/**
 *
 * @author Adam Dickinson
 */
public class POPListener implements Runnable {

    private ServerSocket smtpSocket;
    private Socket connectionSocket;

    public POPListener() throws Exception {
        smtpSocket = new ServerSocket(110);
        
    }

    @Override
    public void run() {

        while (true) {
            try {
                connectionSocket = smtpSocket.accept();
                POPConnection session = new POPConnection(connectionSocket);
                Thread thread = new Thread(session);
                thread.start();
            } catch (Exception ex) {
                System.out.println(ex.getMessage());
            }
        }
    }
}
